Skip to content

Conversation

@rjNemo
Copy link
Owner

@rjNemo rjNemo commented Nov 14, 2025

Summary

Implements the remaining functional programming utilities from ACTION_PLAN.md

New Functions

  • Tap (Issue 21): Apply side effects without changing the slice (debugging/logging)
  • Transpose (Issue 22): Flip matrix rows and columns
  • Unzip (Issue 23): Split tuple slice into two separate slices
  • ParallelReduce (Issue 24): Experimental parallel reduction with worker pool
  • Replicate (Issue 25): Create n copies of a value

Implementation

All functions include:

  • Comprehensive tests with edge cases
  • Proper error handling where applicable
  • Pre-allocated memory for optimal performance
  • Clear documentation with examples

Testing

go test -v -run "TestTap|TestTranspose|TestUnzip|TestParallelReduce|TestReplicate"

All tests pass.

Examples

// Tap - for debugging
Tap([]int{1,2,3}, func(n int) { fmt.Println(n) }) // prints each, returns [1,2,3]

// Transpose
Transpose([[1,2,3], [4,5,6]]) // [[1,4], [2,5], [3,6]]

// Unzip
Unzip([Tuple{1,"a"}, Tuple{2,"b"}]) // ([1,2], ["a","b"])

// Replicate
Replicate(3, "hi") // ["hi", "hi", "hi"]

Related

Resolves Issues 21, 22, 23, 24, 25 from ACTION_PLAN.md

🤖 Generated with Claude Code

- Add Tap: for side effects/debugging in pipelines
- Add Transpose: flip matrix rows and columns
- Add Unzip: split tuple slice into two slices
- Add ParallelReduce: parallel reduction (experimental)
- Add Replicate: create n copies of a value

Comprehensive tests included for all functions.

Resolves Issues 21, 22, 23, 24, 25

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 97.46835% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.65%. Comparing base (d622c8c) to head (376ed9a).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
parallel_reduce.go 95.83% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   98.63%   98.65%   +0.01%     
==========================================
  Files          39       52      +13     
  Lines         367      520     +153     
==========================================
+ Hits          362      513     +151     
- Misses          4        6       +2     
  Partials        1        1              
Flag Coverage Δ
unittests 98.65% <97.46%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rjNemo rjNemo force-pushed the feat/issue-21-25-remaining-utilities branch from ec172a2 to e2468fe Compare November 16, 2025 08:00
Add comprehensive tests covering:
- Default workers (workers <= 0)
- Negative workers
- Error handling and propagation
- Context cancellation during execution
- Context timeout
- Single element processing
- Many workers (more workers than elements)
- Benchmark for performance validation

Coverage increased from 68.75% to 97.5%

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@rjNemo rjNemo force-pushed the feat/issue-21-25-remaining-utilities branch from e2468fe to 376ed9a Compare November 16, 2025 08:02
@rjNemo rjNemo merged commit f33e86d into main Nov 16, 2025
2 checks passed
@rjNemo rjNemo deleted the feat/issue-21-25-remaining-utilities branch November 16, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants